package cn.icanci.ladybird.controller;

import cn.icanci.ladybird.common.result.JsonData;
import cn.icanci.ladybird.pojo.entity.Admin;
import cn.icanci.ladybird.service.AdminService;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author: zxp
 * @date: Created in 2020/10/7 0007 下午 17:05
 * @classAction: 管理员管理页面数据分页
 */
@Controller
@Slf4j
@RequestMapping("/api/v1/pri/admin")
public class AdminDataListController {

    @Autowired
    private AdminService adminService;
    /**
     * 跳转到 ticket-list 票列表
     *
     * @param model 数据处理对象
     * @return 返回视图地址
     */
    @RequestMapping("/admin-list")
    public String adminList(Model model, Integer pageNum, Integer pageSize) {
        // 页面参数，然后在Service进行分页
        PageInfo<Admin> adminPageInfo = adminService.queryAllByNotObject(pageNum, pageSize);
        JsonData jsonData = JsonData.builderSuccess(adminPageInfo);
        model.addAttribute("jsonData", jsonData);
        return "admin/admin-list";
    }
}


